﻿<!DOCTYPE html>
<html lang="en">
<head>
    <meta charset="UTF-8">
    <title>沙孟海</title>
    <link rel="stylesheet" href="~/Areas/Mall/css/head.css">
    <link rel="stylesheet" href="~/Areas/Mall/css/login.css">
    <script type="text/javascript" src="~/Areas/Mall/js/jquery-1.10.2.min.js"></script>
</head>
<body>
    <div class="login-top">
        <img alt="" src="~/Areas/Mall/image/logo_login.png">
    </div>
    <div class="login-txt">
        <div class="login-img">
            <div class="left-img">
                <img alt="" src="~/Areas/Mall/image/left-img.png">
            </div>
            <div class="right-txt">
                <div class="login">
                    <h2>欢迎登录</h2>
                    <div class="txt">
                        <div class="m-list">
                            <div class="m-right">
                                <input id="txtUserName" type="text" class="weui-input" placeholder="管理员账号">
                            </div>
                        </div>
                        <div class="m-list">
                            <div class="m-right1">
                                <input id="txtPassWord" type="password" class="weui-input" placeholder="管理员密码">
                            </div>
                        </div>
                        <p id="tip" class="tc">请输入用户名和密码</p>
                        <div class="m-list">
                            <input type="submit" value="登 录" class="submit" onclick="login()">
                        </div>
                    </div>
                </div>
            </div>
        </div>
    </div>
    <div class="login-font">
        <p>@*地址：山东省济南市历下泉城路318号丰利大厦10楼1009室 <br>电话：15098949988  微信：shuchenglianzi QQ：2020803618  邮箱：2020803619@qq.com*@ <br>Copyright © 2020,沪ICP备2020028394号</p>
    </div>
</body>
</html>
<script type="text/javascript">
    //检测
    function check() {
        var retBool = true;
        //账号
        var userName = $("#txtUserName").val();
        if (userName == undefined || userName == null || userName == "") {
            showTip("账号不能为空");
            retBool = false;
        }

        //密码
        var passWord = $("#txtPassWord").val();
        if (passWord == undefined || passWord == null || passWord == "") {
            showTip("密码不能为空");
            retBool = false;
        }

        return retBool;
    };

    //显示提示
    function showTip(val) {
        $("#tip").text(val);
        $("#tip").show();
    }

    //隐藏提示
    function hideTip() {
        $("#tip").hide();
    }

    //登录
    function login() {
        if (check()) {
            hideTip();
            var userName = $("#txtUserName").val();
            var passWord = $("#txtPassWord").val();

            $.ajax({
                type: "POST",
                url: '@Url.Action("MemberLogin", "Login")',
                data: {
                    "userName": userName,
                    "passWord": passWord
                },
                success: function (res) {
                    if (res.Success) {
                        window.location.href = res.Data + '?r=' + (new Date()).valueOf();//直接跳转
                    } else {
                        showTip(res.Message);
                    }
                }
            });
        }
    }
</script>

